home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / ohmygod.c < prev    next >
C/C++ Source or Header  |  2000-05-18  |  10KB  |  308 lines

  1. /***************************************************************************
  2.  
  3. Oh My God! (c) 1993 Atlus
  4.  
  5. driver by nicola Salmoria
  6.  
  7. Notes:
  8. - not sure about the scroll registers
  9. - lots of unknown RAM, maybe other gfx planes not used by this game
  10.  
  11. ***************************************************************************/
  12.  
  13. #include "driver.h"
  14. #include "vidhrdw/generic.h"
  15.  
  16.  
  17. extern unsigned char *ohmygod_videoram;
  18.  
  19. READ_HANDLER( ohmygod_videoram_r );
  20. WRITE_HANDLER( ohmygod_videoram_w );
  21. WRITE_HANDLER( ohmygod_spritebank_w );
  22. WRITE_HANDLER( ohmygod_scroll_w );
  23. int ohmygod_vh_start(void);
  24. void ohmygod_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  25.  
  26.  
  27.  
  28. int sndbank;
  29.  
  30. static void ohmygod_init_machine(void)
  31. {
  32.     unsigned char *rom = memory_region(REGION_SOUND1);
  33.  
  34.     /* the game requires the watchdog to fire during boot, so we have
  35.        to initialize it */
  36.     watchdog_reset_r(0);
  37.  
  38.     sndbank = 0;
  39.     memcpy(rom + 0x20000,rom + 0x40000 + 0x20000 * sndbank,0x20000);
  40. }
  41.  
  42. WRITE_HANDLER( ohmygod_ctrl_w )
  43. {
  44.     unsigned char *rom = memory_region(REGION_SOUND1);
  45.  
  46.  
  47.     coin_counter_w(0,data & 0x1000);
  48.     coin_counter_w(1,data & 0x2000);
  49.  
  50.     /* ADPCM bank switch */
  51.     if (sndbank != ((data & 0xf0) >> 4))
  52.     {
  53.         sndbank = ((data & 0xf0) >> 4);
  54.         memcpy(rom + 0x20000,rom + 0x40000 + 0x20000 * sndbank,0x20000);
  55.     }
  56. }
  57.  
  58.  
  59.  
  60. static struct MemoryReadAddress readmem[] =
  61. {
  62.     { 0x000000, 0x07ffff, MRA_ROM },
  63.     { 0x300000, 0x303fff, MRA_BANK1 },
  64.     { 0x304000, 0x307fff, ohmygod_videoram_r },
  65.     { 0x308000, 0x30ffff, MRA_BANK2 },
  66.     { 0x700000, 0x701fff, MRA_BANK3 },
  67.     { 0x702000, 0x703fff, MRA_BANK4 },
  68.     { 0x704000, 0x707fff, MRA_BANK5 },
  69.     { 0x708000, 0x70bfff, MRA_BANK6 },
  70.     { 0x800000, 0x800001, input_port_0_r },
  71.     { 0x800002, 0x800003, input_port_1_r },
  72.     { 0xa00000, 0xa00001, input_port_2_r },
  73.     { 0xa00002, 0xa00003, input_port_3_r },
  74.     { 0xb00000, 0xb00001, OKIM6295_status_0_r },
  75.     { 0xc00000, 0xc00001, watchdog_reset_r },
  76.     { -1 }    /* end of table */
  77. };
  78.  
  79. static struct MemoryWriteAddress writemem[] =
  80. {
  81.     { 0x000000, 0x07ffff, MWA_ROM },
  82.     { 0x300000, 0x303fff, MWA_BANK1 },
  83.     { 0x304000, 0x307fff, ohmygod_videoram_w, &ohmygod_videoram },
  84.     { 0x308000, 0x30ffff, MWA_BANK2 },
  85.     { 0x400000, 0x400003, ohmygod_scroll_w },
  86.     { 0x600000, 0x6007ff, paletteram_xGGGGGRRRRRBBBBB_word_w, &paletteram },
  87.     { 0x700000, 0x701fff, MWA_BANK3, &spriteram, &spriteram_size },
  88.     { 0x702000, 0x703fff, MWA_BANK4, &spriteram_2 },
  89.     { 0x704000, 0x707fff, MWA_BANK5 },
  90.     { 0x708000, 0x70bfff, MWA_BANK6 },    /* work RAM */
  91.     { 0x900000, 0x900001, ohmygod_ctrl_w },
  92.     { 0xb00000, 0xb00001, OKIM6295_data_0_w },
  93.     { 0xd00000, 0xd00001, ohmygod_spritebank_w },
  94.     { -1 }    /* end of table */
  95. };
  96.  
  97.  
  98.  
  99. INPUT_PORTS_START( ohmygod )
  100.     PORT_START
  101.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER1 )
  102.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER1 )
  103.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER1 )
  104.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER1 )
  105.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  106.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
  107.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
  108.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
  109.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
  110.     PORT_BITX(0x0200, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  111.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
  112.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
  113.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  114.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  115.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  116.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  117.  
  118.     PORT_START
  119.     PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_PLAYER2 )
  120.     PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_PLAYER2 )
  121.     PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_PLAYER2 )
  122.     PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_PLAYER2 )
  123.     PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  124.     PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  125.     PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
  126.     PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
  127.     PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN2 )
  128.     PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE1 )
  129.     PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
  130.     PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
  131.     PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  132.     PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  133.     PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  134.     PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
  135.  
  136.     PORT_START
  137.     PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
  138.     PORT_DIPNAME( 0x0f00, 0x0f00, DEF_STR( Coin_A ) )
  139.     PORT_DIPSETTING(      0x0700, DEF_STR( 4C_1C ) )
  140.     PORT_DIPSETTING(      0x0800, DEF_STR( 3C_1C ) )
  141.     PORT_DIPSETTING(      0x0500, "6 Coins/3 Credits" )
  142.     PORT_DIPSETTING(      0x0900, DEF_STR( 2C_1C ) )
  143.     PORT_DIPSETTING(      0x0400, DEF_STR( 4C_3C ) )
  144.     PORT_DIPSETTING(      0x0f00, DEF_STR( 1C_1C ) )
  145.     PORT_DIPSETTING(      0x0300, "5 Coins/6 Credits" )
  146.     PORT_DIPSETTING(      0x0200, DEF_STR( 4C_5C ) )
  147. //    PORT_DIPSETTING(      0x0600, DEF_STR( 2C_3C ) )
  148.     PORT_DIPSETTING(      0x0100, DEF_STR( 2C_3C ) )
  149.     PORT_DIPSETTING(      0x0e00, DEF_STR( 1C_2C ) )
  150.     PORT_DIPSETTING(      0x0d00, DEF_STR( 1C_3C ) )
  151.     PORT_DIPSETTING(      0x0c00, DEF_STR( 1C_4C ) )
  152.     PORT_DIPSETTING(      0x0b00, DEF_STR( 1C_5C ) )
  153.     PORT_DIPSETTING(      0x0a00, DEF_STR( 1C_6C ) )
  154.     PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
  155.     PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coin_B ) )
  156.     PORT_DIPSETTING(      0x7000, DEF_STR( 4C_1C ) )
  157.     PORT_DIPSETTING(      0x8000, DEF_STR( 3C_1C ) )
  158.     PORT_DIPSETTING(      0x5000, "6 Coins/3 Credits" )
  159.     PORT_DIPSETTING(      0x9000, DEF_STR( 2C_1C ) )
  160.     PORT_DIPSETTING(      0x4000, DEF_STR( 4C_3C ) )
  161.     PORT_DIPSETTING(      0xf000, DEF_STR( 1C_1C ) )
  162.     PORT_DIPSETTING(      0x3000, "5 Coins/6 Credits" )
  163.     PORT_DIPSETTING(      0x2000, DEF_STR( 4C_5C ) )
  164. //    PORT_DIPSETTING(      0x6000, DEF_STR( 2C_3C ) )
  165.     PORT_DIPSETTING(      0x1000, DEF_STR( 2C_3C ) )
  166.     PORT_DIPSETTING(      0xe000, DEF_STR( 1C_2C ) )
  167.     PORT_DIPSETTING(      0xd000, DEF_STR( 1C_3C ) )
  168.     PORT_DIPSETTING(      0xc000, DEF_STR( 1C_4C ) )
  169.     PORT_DIPSETTING(      0xb000, DEF_STR( 1C_5C ) )
  170.     PORT_DIPSETTING(      0xa000, DEF_STR( 1C_6C ) )
  171.     PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
  172.  
  173.     PORT_START
  174.     PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
  175.     PORT_DIPNAME( 0x0300, 0x0300, "1P Difficulty" )
  176.     PORT_DIPSETTING(      0x0200, "Easy" )
  177.     PORT_DIPSETTING(      0x0300, "Normal" )
  178.     PORT_DIPSETTING(      0x0100, "Hard" )
  179.     PORT_DIPSETTING(      0x0000, "Very Hard" )
  180.     PORT_DIPNAME( 0x0c00, 0x0c00, "VS Difficulty" )
  181.     PORT_DIPSETTING(      0x0c00, "Normal Jake" )
  182.     PORT_DIPSETTING(      0x0800, "Hard Jake" )
  183.     PORT_DIPSETTING(      0x0400, "Normal" )
  184.     PORT_DIPSETTING(      0x0000, "Hard" )
  185.     PORT_DIPNAME( 0x1000, 0x1000, "Vs Matches/Credit" )
  186.     PORT_DIPSETTING(      0x0000, "1" )
  187.     PORT_DIPSETTING(      0x1000, "3" )
  188.     PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Demo_Sounds ) )
  189.     PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
  190.     PORT_DIPSETTING(      0x2000, DEF_STR( On ) )
  191.     PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
  192.     PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
  193.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  194.     PORT_DIPNAME( 0x8000, 0x8000, "Test Mode" )
  195.     PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
  196.     PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
  197. INPUT_PORTS_END
  198.  
  199.  
  200.  
  201. static struct GfxLayout charlayout =
  202. {
  203.     8,8,
  204.     RGN_FRAC(1,1),
  205.     4,
  206.     { 0, 1, 2, 3 },
  207.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  208.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  209.     32*8
  210. };
  211.  
  212. static struct GfxLayout spritelayout =
  213. {
  214.     16,16,
  215.     RGN_FRAC(1,1),
  216.     4,
  217.     { 0, 1, 2, 3 },
  218.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
  219.             8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4, },
  220.     { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
  221.             8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
  222.     128*8
  223. };
  224.  
  225. static struct GfxDecodeInfo gfxdecodeinfo[] =
  226. {
  227.     { REGION_GFX1, 0, &charlayout,     0, 16 },    /* colors   0-255 */
  228.     { REGION_GFX2, 0, &spritelayout, 512, 16 },    /* colors 512-767 */
  229.     { -1 } /* end of array */
  230. };
  231.  
  232.  
  233.  
  234. static struct OKIM6295interface okim6295_interface =
  235. {
  236.     1,          /* 1 chip */
  237.     { 16000 },    /* 16 kHz ??? */
  238.     { REGION_SOUND1 },    /* memory region */
  239.     { 100 }
  240. };
  241.  
  242.  
  243.  
  244. static struct MachineDriver machine_driver_ohmygod =
  245. {
  246.     /* basic machine hardware */
  247.     {
  248.         {
  249.             CPU_M68000,
  250.             12000000,    /* ??? */
  251.             readmem,writemem,0,0,
  252.             m68_level1_irq,1
  253.         }
  254.     },
  255.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  256.     1,
  257.     ohmygod_init_machine,
  258.  
  259.     /* video hardware */
  260.     64*8, 32*8, { 12*8, (64-12)*8-1, 0*8, 30*8-1 },
  261.     gfxdecodeinfo,
  262.     1024, 1024,
  263.     0,
  264.  
  265.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  266.     0,
  267.     ohmygod_vh_start,
  268.     0,
  269.     ohmygod_vh_screenrefresh,
  270.  
  271.     /* sound hardware */
  272.     0,0,0,0,
  273.       {
  274.         {
  275.             SOUND_OKIM6295,
  276.             &okim6295_interface
  277.         }
  278.     }
  279. };
  280.  
  281.  
  282.  
  283. /***************************************************************************
  284.  
  285.   Game driver(s)
  286.  
  287. ***************************************************************************/
  288.  
  289. ROM_START( ohmygod )
  290.     ROM_REGION( 0x80000, REGION_CPU1 )
  291.     ROM_LOAD_WIDE_SWAP( "omg-p.114", 0x00000, 0x80000, 0x48fa40ca )
  292.  
  293.     ROM_REGION( 0x80000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  294.     ROM_LOAD( "omg-b.117",    0x00000, 0x80000, 0x73621fa6 )
  295.  
  296.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  297.     ROM_LOAD( "omg-s.120",    0x00000, 0x80000, 0x6413bd36 )
  298.  
  299.     ROM_REGION( 0x240000, REGION_SOUND1 )
  300.     ROM_LOAD( "omg-g.107",    0x00000, 0x200000, 0x7405573c )
  301.     /* 00000-1ffff is fixed, 20000-3ffff is banked */
  302.     ROM_RELOAD(               0x40000, 0x200000 )
  303. ROM_END
  304.  
  305.  
  306.  
  307. GAME( 1993, ohmygod, 0, ohmygod, ohmygod, 0, ROT0, "Atlus", "Oh My God! (Japan)" )
  308.